package com.cloudlead.dictionaryAction.action;

import com.cloudlead.common.lang.annotation.Label;
import com.cloudlead.common.worker.action.impl.AbstractActionFactory;
import com.cloudlead.common.worker.annotation.Action;
import com.cloudlead.common.worker.annotation.Order;
import com.cloudlead.dictionaryAction.BusinessModules;
import com.cloudlead.dictionaryAction.service.RegionEditSer;
import com.cloudlead.dictionaryService.RegionEditService;
import com.cloudlead.dictionaryService.vo.RegionVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.util.List;

/**
 * Created by wyj on 2015/8/18.
 */
@Controller
public class RegionEditActionFactory extends AbstractActionFactory implements RegionEditService {
    public RegionEditActionFactory() {
        super(BusinessModules.RegionEdit);
    }
    @Autowired
    RegionEditSer regionEditSer;

    @Override
    @Action
    @Order(1)
    @Label("行政区域创建")
    public String createRegion(@NotNull RegionVo vo) {
        return regionEditSer.createRegion(vo);
    }

    @Action
    @Order(2)
    @Label("单值查询")
    public RegionVo findOneRegion(@NotNull @Label("查询条件") RegionVo vo) {

        return regionEditSer.findOneRegion(vo);
    }

    @Action
    @Order(3)
    @Label("多值查询")
    public List<RegionVo> findAllRegion(@NotNull @Label("查询条件") RegionVo vo) {
         return regionEditSer.findAllRegion(vo);
    }

    @Action
    @Order(4)
    @Label("行政区域删除")
    public String delRegion(@NotNull @Label("行政区域ID")String id) {
        return regionEditSer.delRegion(id);
    }
}
